import Vue from 'vue'
import VueRouter from 'vue-router'

// Vite项目，.vue
import Login from '@/views/login.vue'
import Register from '@/views/register.vue'
import Detail from '@/views/detail.vue'
import Layout from '@/views/layout.vue'
// 二级路由
import Like from '@/views/second/like.vue'
import Article from '@/views/second/article.vue'
import Collect from '@/views/second/collect.vue'
import User from '@/views/second/user.vue'
Vue.use(VueRouter)

const router = new VueRouter({
    routes: [
        { path: '/login', component: Login, name: 'Login' },
        { path: '/register', component: Register },
        { path: '/detail/:id', component: Detail },
        {
            path: '/',
            name: 'Layout',
            component: Layout,
            redirect: '/article',
            // 二级路由配置
            children: [
                { path: '/article', component: Article },
                { path: '/like', component: Like },
                { path: '/collect', component: Collect },
                { path: '/user', component: User }
            ]
        }
    ]
})

export default router
